import request from '@/utils/request'

/**
 * 获取月卡列表
 * @param { page, pageSize} params
 * @returns
 */
export const getEnterpriseListAPI = (params) => request.get('/park/enterprise', { params })

// 获取行业列表
export const getIndustryListAPI = () => request.get('/park/industry')

// 新增企业
export const addEnterpriseAPI = (data) => request.post('/park/enterprise', data)

// 上传营业执照
export const uploadLicenseAPI = (data) => request.post('/upload', data)

// 查看企业信息
export const getEnterpriseInfoAPI = (id) => request.get(`/park/enterprise/${id}`)

// 修改企业信息
export const updateEnterpriseAPI = (data) => request.put('/park/enterprise', data)

// 删除企业信息
export const deleteEnterpriseAPI = (id) => request.delete(`/park/enterprise/${id}`)

// 添加合同
export const addContractAPI = (data) => request.post('/park/enterprise/rent', data)

// 查询可租赁楼宇
export const getBuildingListAPI = () => request.get('/park/rent/building')

/**
 * 获取企业下合同列表
 * @param {*} id
 * @returns
 */
export function getRentListAPI(id) {
  return request({
    url: `/park/enterprise/rent/${id}`
  })
}
/**
 * 退租
 * @param {合同id} rentId
 * @returns
 */

export function outRentAPI(rentId) {
  return request({
    url: `/park/enterprise/rent/${rentId}`,
    method: 'PUT'
  })
}
/**
 *删除租赁合同
 *
 * @export
 * @param {*} rentId 合同id
 * @return {*}
 */
export function delRentAPI(rentId) {
  return request({
    url: `/park/enterprise/rent/${rentId}`,
    method: 'DELETE'
  })
}
/**
 * 获取详情
 * @param {企业id} id
 * @returns
 */

export function getEnterpriseDetailAPI(id) {
  return request({
    url: `/park/enterprise/${id}`,
    method: 'GET'
  })
}

/**
 * 下载合同文件
 */
export function downloadContract(id) {
  return request(`/download/${id}`, {
    responseType: 'blob'
  })
}

